var phantom = require("phantom");

async function create() {
  const ph = await phantom.create();
  const page = await ph.createPage();
  await page.open("https://www.baidu.com");
  page.property("viewportSize", { width: 1920, height: 1080 });
  await page.render("./baidu.pdf");
  await page.render("./baidu.jpg");
  console.log("Page rendered");
  ph.exit();
}

async function createLocal() {
  const ph = await phantom.create();
  const page = await ph.createPage();
  await page.open("http://localhost:3000/");
  page.property("viewportSize", { width: 1920, height: 1080 });
  await page.render("./local.pdf");
  await page.render("./local.jpg");
  console.log("Page rendered");
  ph.exit();
}

create();
createLocal();
